home *** CD-ROM | disk | FTP | other *** search
/ NOVA - For the NeXT Workstation / NOVA - For the NeXT Workstation.iso / Documents / NeXTAnswers / appkit.573 < prev    next >
Text File  |  1992-02-06  |  2KB  |  50 lines

  1. {\rtf0\ansi{\fonttbl\f0\fnil Times-Roman;\f1\fmodern Courier;}
  2. \paperw11760
  3. \paperh7200
  4. \margl120
  5. \margr120
  6. \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\f0\b0\i0\ul0\fs28 SavePanel OpenPanel PrintPanel name title\
  7.     \
  8. Q:  Is there any way to change the title of the Save, Open or Print panels without having to subclass those objects?\
  9.  
  10. \i     \
  11.  
  12. \i0 A:  In your application you can insert the following code snippet to change the name on the open panel dynamically. It will also work for the other standard panels:\
  13. \
  14.  
  15. \f1\fs24 #include <appkit/OpenPanel.h>\
  16.     ...\
  17.  
  18. \f0\fs28 \
  19.  
  20. \f1\fs24     id openPanel = [OpenPanel new];\
  21.     [[[openPanel contentView] findViewWithTag: NX_OPTITLEFIELD]\
  22.         setStringValue: "New Name"];\
  23.     \
  24.     
  25. \f0\fs28 \
  26. In 2.0, it's better yet if you take the time to internationalize the panel name. In this case the code will look more like the following snippet and will require some additional setup in IB:\
  27. \
  28.  
  29. \f1\fs24 #include <appkit/OpenPanel.h>\
  30.     ...\
  31.     id openPanel = [OpenPanel new];\
  32.     [[[openPanel contentView] findViewWithTag: NX_OPTITLEFIELD]\
  33.         setStringValue: [myStrings valueForStringKey: OPEN_STRING];\
  34.  
  35. \f0\fs28 \
  36. The tag definitions for the standard panels are:\
  37. \
  38. Choose Printer Panel:    NX_CPTITLEFIELD    <appkit/ChoosePrinter.h>\
  39. Open Panel:        NX_OPTITLEFIELD    <appkit/OpenPanel.h>\
  40. Page Layout Panel:    NX_PLTITLEFIELD    <appkit/PageLayout.h>\
  41. Print Panel:        NX_PPTITLEFIELD    <appkit/PrintPanel.h>\
  42. Save Panel:        NX_SPTITLEFIELD    <appkit/SavePanel.h>\
  43. \
  44. QA573    \
  45. \
  46. Valid for 1.0  (with the exception of string internationalization as noted)\
  47. Valid for 2.0           \
  48. \
  49.  
  50.